package cn.ex;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class LinkedList2 {
    public static void main(String[] args) {
        LinkedList<String> list  = new LinkedList<>(List.of("java","html","vue","java","java"));
        System.out.println(list);
        System.out.println(list.get(0));
        System.out.println(list.getFirst());
        System.out.println(list.getLast());
        System.out.println(list.get(2));

        //list.size()
        //list.contains()
        System.out.println(list.contains("java"));

        //list.clear();
        list.push("java");
        System.out.println(list);
        System.out.println(list.remove("java"));
        System.out.println(list);

        //while(list.remove("java"));
        //System.out.println(list);

        //list.remove();


        //List<String> list2  = new ArrayList<>(List.of("java","html","vue"));
        //System.out.println(list2.get(2));


        //System.out.println(list.getFirst());
        //System.out.println(list.get(0));
        System.out.println(list.peek());
        System.out.println(list);
        list.set(0,"javascript");
        System.out.println(list);

        //返回的list对象是动态
        List<String> ll = list.subList(0,3);
        ll.clear();
        System.out.println(ll);
    }

}
